<?php
namespace Android\Controller;
use Think\Controller;
class ActivityController extends Controller {
    //  活动的查找
    public function find(){
        $info=M('Activity');
        $user_id=$_GET['user_id'];
        $infos=$info->where("user_id=$user_id")->select();
        echo json_encode($infos);
    }
    //  活动的添加
    public function add()
    {
        $info=D('Activity');
        $data = $info->create();
        session(array('name'=>'session_id','expire'=>3600));
        $success = $info->data($data)->add();
        if ($success) {
            echo "1";
        } else {
            echo "0";
        }
    }
    //获取拼单详情
   public function  Act_together(){
       $act_id=$_POST['act_id'];
       $act=D('activity');
       $user_type=2;
       $type=2;
       $info= $act->Act_together($act_id, $user_type,$type);
       echo json_encode($info);
   }
   //获取约客一族的活动
    public  function  act_main()
    {
        $act_id = $_POST['act_id'];
        $act = D('activity');
        $user_type = 1;
        $type = 1;
        $info = $act->Act_together($act_id, $user_type, $type);
        echo json_encode($info);
    }
    //查询未开始的活动
    public function act_shall(){
        $act_id=$_GET['act_id'];
        $act=D('activity');
        $user_type=1;
        $type=1;
        $status=1;
        $info= $act->Act_together($act_id, $user_type,$type);
    }
    //获取正在进行的活动
    public function act_ing(){
        $act_id=$_GET['act_id'];
        $act=D('activity' );
        $user_type=1;
        $type=1;
        $status=2;
       $info= $act->Act_together($act_id, $user_type,$type,$status);
    }
    //获取正在p拼单和活动的的列表页面
    public function act_list(){
        $status=$_POST['status'];
        $act=D('activity');
        $info= $act->Act_togetherlist($status);
        echo json_encode($info);
   }
   //获取热门推荐的活动内容
   public function hot(){
       $act=D('activity');
       $info=$act->hot();
       echo json_encode($info);
   }

}
